package com.qf.listener;

import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

//@Component
//@RocketMQMessageListener(topic = "test",consumerGroup = "rocket-con-group1")
public class RocketMQConsumer1 implements RocketMQListener<Message> {
    @Override
    public void onMessage(Message message) {
        try {
            String keys = message.getKeys();
            String tags = message.getTags();
            String s = new String(message.getBody(), "utf-8");


            System.out.println("con1===key:" + keys +"--tags:" + tags + "--msg:" + s);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
